package com.gitee.wsl.mathematics.geometry.d2.contour.ext


fun List<Double>.merge(f: (Double, Double) -> Boolean): List<Double> {
    val result = mutableListOf<Double>()
    result.add(this[0])
    var last = this[0]
    for (i in 1 until size) {
        if (!f(last, this[i])) {
            result.add(this[i])
            last = this[i]
        }
    }
    return result
}